package edu.sctu;

import edu.sctu.util.DBUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class UpdateDate extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String updateid = req.getParameter("updateid");
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        User user = new User();
        user.setId(Integer.valueOf(updateid));
        user.setName(username);
        user.setPassword(password);
        DBUtil.update(user);
        User user1=new User();

        /*User user = new User();*/
        req.setAttribute("list",DBUtil.query(user));
        req.getRequestDispatcher("/userList.jsp").forward(req, resp);
    }
}
